{% extends '::base.html.twig' %}
{% block body %}
<div style="height: 250px;">
  <img src="{{ asset(staff.getWebPath()) }}" class="image" alt="Big Image" />
  <h1>{{ staff.getName() }}</h1>
  <p>{{ staff.getDescription()|raw }}</p>
</div>
<div>
  <div class="comment_2 ui-corner-all">
    <div class="comment_2_header">
      <div class="comment_2_content">Отзывы:</div>
      <div class="comment_2_button">
        <input type="button" id="add_comment_button" value="Добавить Отзыв" />
      </div>
    </div>
    {% for comment in staff.getComments() %}
      {% include 'AcmeStaffBundle:Comment:index.html.twig' with {'comment': comment, 'padding': 0} %}
      </br>
    {% endfor %}
  </div>
  <div id="add_comment" title="Добавить Отзыв">
  <form action="{{ path('_save_staff_comment', {'staff_id': staff.getId() }) }}" method="POST" id="form_add_comment"  >
                            {{ form_widget(add_comment_form) }}
    
  </form>  
  </div>
</div>
{% endblock %}
{% block post_init_javascript %}
{{ parent() }}
$("input:button").button();
$( "div#add_comment" ).dialog({
			autoOpen: false,
			height: 400,
			width: 550,
			modal: true,
			buttons: {
				"Add Comment": function() {
                                   $( this ).dialog( "close" );
                                   $('#form_add_comment').submit();
				},
				Cancel: function() {
					$( this ).dialog( "close" );
				}
			}
		});
$("#add_comment_button").click(function(){
  $('#form_add_comment').attr('action', "{{ path('_save_staff_comment', {'staff_id': staff.getId() }) }}");
  $( "div#add_comment" ).dialog("open");
});
$(".add_c").click(function() {
  $('#form_add_comment').attr('action', "{{ path('_save_staff_comment', {'staff_id': staff.getId() }) }}" + "/" + $(this).attr('id'));
  $( "div#add_comment" ).dialog("open");
  return false;
})
{% endblock %}
{% block post_javascripts %}
  {{ tinymce_init() }}
{% endblock %}